package com.sx.manage.service.consumer.register;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.sx.manage.service.consumer.IMBaseConsumerOperationInfoService;
import com.sx.manage.util.WebServiceUtils;

/**
 * 推荐人领取奖励
 * @author Administrator
 *
 */
@Service("refereeReceiveReward")
public class RefereeReceiveReward {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	/** 绑卡人的id*/
	private Long consumer_id;
	
	@Resource(name="mBaseConsumerOperationInfoServiceImpl")
	private IMBaseConsumerOperationInfoService mBaseConsumerOperationInfoServiceImpl;
	
	//@Resource(name="platformService")
	//private IPlatformServiceInterface platformService;
	
	@Resource(name="webServiceUtils")
	private WebServiceUtils webServiceUtils;
	
	public Logger getLogger() {
		return logger;
	}
	public void setLogger(Logger logger) {
		this.logger = logger;
	}
	public Long getConsumer_id() {
		return consumer_id;
	}
	public void setConsumer_id(Long consumer_id) {
		this.consumer_id = consumer_id;
	}
	public IMBaseConsumerOperationInfoService getmBaseConsumerOperationInfoServiceImpl() {
		return mBaseConsumerOperationInfoServiceImpl;
	}
	public void setmBaseConsumerOperationInfoServiceImpl(IMBaseConsumerOperationInfoService mBaseConsumerOperationInfoServiceImpl) {
		this.mBaseConsumerOperationInfoServiceImpl = mBaseConsumerOperationInfoServiceImpl;
	}
	
	public void threadStart() {
		FunctionThread threadFunc = new FunctionThread();
		logger.info("用户领取推荐码奖励多线程启动");
		threadFunc.start();
	}
	
	
	public class FunctionThread extends Thread{
		private Logger log = LoggerFactory.getLogger(this.getClass());
		public void run() {
			/*log.info("consumer_id={}开始领取推荐码奖励",consumer_id);
			//绑卡人扩展信息
			MConsumerOperationInfoVO bindOperationVO = mBaseConsumerOperationInfoServiceImpl.queryByConsumerId(consumer_id).getObjVo();
			if(StringUtils.isBlank(bindOperationVO.getReferral_code_referee())) {
				log.info("没有推荐人，程序终止consumer_id={}",consumer_id);
				return ;
			}
			//根据推荐码查询个人
			MConsumerOperationInfoForm form = new MConsumerOperationInfoForm();
			form.setReferral_code_self(bindOperationVO.getReferral_code_referee());
			List<MConsumerOperationInfoVO> operList = mBaseConsumerOperationInfoServiceImpl.queryListByForm(form).getData();
			if(null==operList||operList.size()>1) {
				log.info("推荐码不能确定唯一性程序终止referral_code_referee={}",bindOperationVO.getReferral_code_referee());
				return;
			}
			MConsumerOperationInfoVO referOperationVO = operList.get(0);*/
			
			
		}
	}
	
}
